/*
 * @Author: Dagon
 * @Date: 2021-02-24 15:22:17
 * @Description: 实现类型判断函数
 */
function getType(param) {
  const type = Object.prototype.toString.call(param).slice(8, -1) // 核心
  console.log(333, type) // Object.prototype.toString.call(param)
  if (type === "Object") {
    return param.constructor.name
  } else {
    return type
  }
}

console.log(getType({age: 18}))